<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="div_mod" style="height: 300px;width: 300px;border: 1px solid blue;">
			
		</div>
		<button type="button" onclick="add()">添加监听器</button>
		<button type="button" onclick="remove()">移除监听器</button>
	</body>
	<script type="text/javascript">
		// 4.实现DIV 鼠标移动事件，采用监听器方式操作，可实现添加和清除监听器功能。
		function temp(){
			console.log('鼠标正在移动')
		}
		function add(){
			document.getElementById('div_mod').addEventListener('mousemove',temp)
			alert('监听器添加成功')
		}
		function remove(){
			document.getElementById('div_mod').removeEventListener('mousemove',temp)
			alert('监听器移除成功')
		}
	</script>
</html>
